#include <vector>
#include <algorithm>

struct Participant {
    int id;
    int score;
    Participant(int id_, int score_) : id(id_), score(score_) {}
    bool operator<(Participant const & other) const {
        return this->score < other.score;
    }
    bool operator==(Participant const & other) const {
        return this->score == other.score;
    }
};

template<typename P>
class WhoGetsSelected {
public:
    using Vec = std::vector<P>;
    static auto expect_first_(int expected_num, Vec l) -> Vec {
        if (expected_num > l.size()) return {};
        std::sort(l.begin(), l.end());
        auto it = l.rbegin();
        std::advance(it, expected_num - 1);
        return { std::lower_bound(l.begin(), l.end(), P{0, it->score}), l.end() };
    }
};

#include <iostream>

int main() {
    using P = Participant;

    int n, m;
    std::cin >> n >> m;

    WhoGetsSelected<P>::Vec data;
    data.reserve(n);

    for (int i = 0, id, score; i < n; ++i) {
        std::cin >> id >> score;
        data.emplace_back(id, score);
    }

    auto selected = WhoGetsSelected<P>::expect_first_(1.5 * m, std::move(data));
    
    std::sort(selected.begin(), selected.end(), [](P const& a, P const& b) {
        return a.score > b.score || (a.score == b.score && a.id < b.id);
    });

    std::cout << selected.back().score << " " << selected.size() << "\n";

    for (auto const & i : selected) {
        std::cout << i.id << " " << i.score << "\n";
    }
}
